package com.example.com.order.controller;

import com.example.com.order.entity.Order;
import com.example.com.order.fegin.StockFeignService;
import com.example.com.order.service.OrderService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private StockFeignService stockFeignService;
    @Autowired
    private OrderService orderService;


//
//    @Value("${user.name}")
//    private String name;
//    @Value("${user.age}")
//    private Integer age;
//
//    @RequestMapping("/info")
//    public String info(){
//        return "姓名："+name+"，年龄："+age;
//    }

    @GetMapping("/addOrder")
    public Order createOrder(@RequestParam("productId") Integer productId){
        return orderService.createOrder(new Order());
    }


    @RequestMapping("/getUserInfo")
    public String getUserInfo(){
        return orderService.getUserInfo();
    }

    @GetMapping("/readOrder")
    public String readOrder(){
        System.out.println("网关测试：order服务");
        return "网关测试：order服务";
    }

}